Optimal. Leaf size=193 \[ \frac {\left (3 a^4+4 a^2 b^2+8 b^4\right ) x}{8 a^5}-\frac {2 b^5 \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^5 \sqrt {a-b} \sqrt {a+b} d}-\frac {b \left (2 a^2+3 b^2\right ) \sin (c+d x)}{3 a^4 d}+\frac {\left (3 a^2+4 b^2\right ) \cos (c+d x) \sin (c+d x)}{8 a^3 d}-\frac {b \cos ^2(c+d x) \sin (c+d x)}{3 a^2 d}+\frac {\cos ^3(c+d x) \sin (c+d x)}{4 a d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.48, antiderivative size = 193, normalized size of antiderivative = 1.00, number of steps
used = 8, number of rules used = 6, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {3938, 4189,
4004, 3916, 2738, 214} \begin {gather*} -\frac {2 b^5 \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^5 d \sqrt {a-b} \sqrt {a+b}}-\frac {b \sin (c+d x) \cos ^2(c+d x)}{3 a^2 d}-\frac {b \left (2 a^2+3 b^2\right ) \sin (c+d x)}{3 a^4 d}+\frac {\left (3 a^2+4 b^2\right ) \sin (c+d x) \cos (c+d x)}{8 a^3 d}+\frac {x \left (3 a^4+4 a^2 b^2+8 b^4\right )}{8 a^5}+\frac {\sin (c+d x) \cos ^3(c+d x)}{4 a d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 214
Rule 2738
Rule 3916
Rule 3938
Rule 4004
Rule 4189
Rubi steps
\begin {align*} \int \frac {\cos ^4(c+d x)}{a+b \sec (c+d x)} \, dx &=\frac {\cos ^3(c+d x) \sin (c+d x)}{4 a d}+\frac {\int \frac {\cos ^3(c+d x) \left (-4 b+3 a \sec (c+d x)+3 b \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx}{4 a}\\ &=-\frac {b \cos ^2(c+d x) \sin (c+d x)}{3 a^2 d}+\frac {\cos ^3(c+d x) \sin (c+d x)}{4 a d}-\frac {\int \frac {\cos ^2(c+d x) \left (-3 \left (3 a^2+4 b^2\right )-a b \sec (c+d x)+8 b^2 \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx}{12 a^2}\\ &=\frac {\left (3 a^2+4 b^2\right ) \cos (c+d x) \sin (c+d x)}{8 a^3 d}-\frac {b \cos ^2(c+d x) \sin (c+d x)}{3 a^2 d}+\frac {\cos ^3(c+d x) \sin (c+d x)}{4 a d}+\frac {\int \frac {\cos (c+d x) \left (-8 b \left (2 a^2+3 b^2\right )+a \left (9 a^2-4 b^2\right ) \sec (c+d x)+3 b \left (3 a^2+4 b^2\right ) \sec ^2(c+d x)\right )}{a+b \sec (c+d x)} \, dx}{24 a^3}\\ &=-\frac {b \left (2 a^2+3 b^2\right ) \sin (c+d x)}{3 a^4 d}+\frac {\left (3 a^2+4 b^2\right ) \cos (c+d x) \sin (c+d x)}{8 a^3 d}-\frac {b \cos ^2(c+d x) \sin (c+d x)}{3 a^2 d}+\frac {\cos ^3(c+d x) \sin (c+d x)}{4 a d}-\frac {\int \frac {-3 \left (3 a^4+4 a^2 b^2+8 b^4\right )-3 a b \left (3 a^2+4 b^2\right ) \sec (c+d x)}{a+b \sec (c+d x)} \, dx}{24 a^4}\\ &=\frac {\left (3 a^4+4 a^2 b^2+8 b^4\right ) x}{8 a^5}-\frac {b \left (2 a^2+3 b^2\right ) \sin (c+d x)}{3 a^4 d}+\frac {\left (3 a^2+4 b^2\right ) \cos (c+d x) \sin (c+d x)}{8 a^3 d}-\frac {b \cos ^2(c+d x) \sin (c+d x)}{3 a^2 d}+\frac {\cos ^3(c+d x) \sin (c+d x)}{4 a d}-\frac {b^5 \int \frac {\sec (c+d x)}{a+b \sec (c+d x)} \, dx}{a^5}\\ &=\frac {\left (3 a^4+4 a^2 b^2+8 b^4\right ) x}{8 a^5}-\frac {b \left (2 a^2+3 b^2\right ) \sin (c+d x)}{3 a^4 d}+\frac {\left (3 a^2+4 b^2\right ) \cos (c+d x) \sin (c+d x)}{8 a^3 d}-\frac {b \cos ^2(c+d x) \sin (c+d x)}{3 a^2 d}+\frac {\cos ^3(c+d x) \sin (c+d x)}{4 a d}-\frac {b^4 \int \frac {1}{1+\frac {a \cos (c+d x)}{b}} \, dx}{a^5}\\ &=\frac {\left (3 a^4+4 a^2 b^2+8 b^4\right ) x}{8 a^5}-\frac {b \left (2 a^2+3 b^2\right ) \sin (c+d x)}{3 a^4 d}+\frac {\left (3 a^2+4 b^2\right ) \cos (c+d x) \sin (c+d x)}{8 a^3 d}-\frac {b \cos ^2(c+d x) \sin (c+d x)}{3 a^2 d}+\frac {\cos ^3(c+d x) \sin (c+d x)}{4 a d}-\frac {\left (2 b^4\right ) \text {Subst}\left (\int \frac {1}{1+\frac {a}{b}+\left (1-\frac {a}{b}\right ) x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{a^5 d}\\ &=\frac {\left (3 a^4+4 a^2 b^2+8 b^4\right ) x}{8 a^5}-\frac {2 b^5 \tanh ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a^5 \sqrt {a-b} \sqrt {a+b} d}-\frac {b \left (2 a^2+3 b^2\right ) \sin (c+d x)}{3 a^4 d}+\frac {\left (3 a^2+4 b^2\right ) \cos (c+d x) \sin (c+d x)}{8 a^3 d}-\frac {b \cos ^2(c+d x) \sin (c+d x)}{3 a^2 d}+\frac {\cos ^3(c+d x) \sin (c+d x)}{4 a d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.61, size = 153, normalized size = 0.79 \begin {gather*} \frac {12 \left (3 a^4+4 a^2 b^2+8 b^4\right ) (c+d x)+\frac {192 b^5 \tanh ^{-1}\left (\frac {(-a+b) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2}}-24 a b \left (3 a^2+4 b^2\right ) \sin (c+d x)+24 a^2 \left (a^2+b^2\right ) \sin (2 (c+d x))-8 a^3 b \sin (3 (c+d x))+3 a^4 \sin (4 (c+d x))}{96 a^5 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.16, size = 256, normalized size = 1.33
method | result | size |
derivativedivides | \(\frac {\frac {\frac {2 \left (\left (-\frac {5}{8} a^{4}-b \,a^{3}-\frac {1}{2} b^{2} a^{2}-b^{3} a \right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (\frac {3}{8} a^{4}-\frac {5}{3} b \,a^{3}-3 b^{3} a -\frac {1}{2} b^{2} a^{2}\right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (-\frac {3}{8} a^{4}+\frac {1}{2} b^{2} a^{2}-\frac {5}{3} b \,a^{3}-3 b^{3} a \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (\frac {5}{8} a^{4}+\frac {1}{2} b^{2} a^{2}-b \,a^{3}-b^{3} a \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{4}}+\frac {\left (3 a^{4}+4 b^{2} a^{2}+8 b^{4}\right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4}}{a^{5}}-\frac {2 b^{5} \arctanh \left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{a^{5} \sqrt {\left (a +b \right ) \left (a -b \right )}}}{d}\) | \(256\) |
default | \(\frac {\frac {\frac {2 \left (\left (-\frac {5}{8} a^{4}-b \,a^{3}-\frac {1}{2} b^{2} a^{2}-b^{3} a \right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (\frac {3}{8} a^{4}-\frac {5}{3} b \,a^{3}-3 b^{3} a -\frac {1}{2} b^{2} a^{2}\right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (-\frac {3}{8} a^{4}+\frac {1}{2} b^{2} a^{2}-\frac {5}{3} b \,a^{3}-3 b^{3} a \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (\frac {5}{8} a^{4}+\frac {1}{2} b^{2} a^{2}-b \,a^{3}-b^{3} a \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{4}}+\frac {\left (3 a^{4}+4 b^{2} a^{2}+8 b^{4}\right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4}}{a^{5}}-\frac {2 b^{5} \arctanh \left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{a^{5} \sqrt {\left (a +b \right ) \left (a -b \right )}}}{d}\) | \(256\) |
risch | \(\frac {3 x}{8 a}+\frac {x \,b^{2}}{2 a^{3}}+\frac {x \,b^{4}}{a^{5}}+\frac {3 i b \,{\mathrm e}^{i \left (d x +c \right )}}{8 a^{2} d}+\frac {i b^{3} {\mathrm e}^{i \left (d x +c \right )}}{2 a^{4} d}-\frac {3 i b \,{\mathrm e}^{-i \left (d x +c \right )}}{8 a^{2} d}-\frac {i b^{3} {\mathrm e}^{-i \left (d x +c \right )}}{2 a^{4} d}+\frac {b^{5} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-b \sqrt {a^{2}-b^{2}}}{a \sqrt {a^{2}-b^{2}}}\right )}{\sqrt {a^{2}-b^{2}}\, d \,a^{5}}-\frac {b^{5} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+b \sqrt {a^{2}-b^{2}}}{a \sqrt {a^{2}-b^{2}}}\right )}{\sqrt {a^{2}-b^{2}}\, d \,a^{5}}+\frac {\sin \left (4 d x +4 c \right )}{32 a d}-\frac {b \sin \left (3 d x +3 c \right )}{12 a^{2} d}+\frac {\sin \left (2 d x +2 c \right )}{4 a d}+\frac {\sin \left (2 d x +2 c \right ) b^{2}}{4 a^{3} d}\) | \(326\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 3.58, size = 482, normalized size = 2.50 \begin {gather*} \left [\frac {12 \, \sqrt {a^{2} - b^{2}} b^{5} \log \left (\frac {2 \, a b \cos \left (d x + c\right ) - {\left (a^{2} - 2 \, b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, \sqrt {a^{2} - b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )} \sin \left (d x + c\right ) + 2 \, a^{2} - b^{2}}{a^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + b^{2}}\right ) + 3 \, {\left (3 \, a^{6} + a^{4} b^{2} + 4 \, a^{2} b^{4} - 8 \, b^{6}\right )} d x - {\left (16 \, a^{5} b + 8 \, a^{3} b^{3} - 24 \, a b^{5} - 6 \, {\left (a^{6} - a^{4} b^{2}\right )} \cos \left (d x + c\right )^{3} + 8 \, {\left (a^{5} b - a^{3} b^{3}\right )} \cos \left (d x + c\right )^{2} - 3 \, {\left (3 \, a^{6} + a^{4} b^{2} - 4 \, a^{2} b^{4}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{24 \, {\left (a^{7} - a^{5} b^{2}\right )} d}, -\frac {24 \, \sqrt {-a^{2} + b^{2}} b^{5} \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )}}{{\left (a^{2} - b^{2}\right )} \sin \left (d x + c\right )}\right ) - 3 \, {\left (3 \, a^{6} + a^{4} b^{2} + 4 \, a^{2} b^{4} - 8 \, b^{6}\right )} d x + {\left (16 \, a^{5} b + 8 \, a^{3} b^{3} - 24 \, a b^{5} - 6 \, {\left (a^{6} - a^{4} b^{2}\right )} \cos \left (d x + c\right )^{3} + 8 \, {\left (a^{5} b - a^{3} b^{3}\right )} \cos \left (d x + c\right )^{2} - 3 \, {\left (3 \, a^{6} + a^{4} b^{2} - 4 \, a^{2} b^{4}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{24 \, {\left (a^{7} - a^{5} b^{2}\right )} d}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\cos ^{4}{\left (c + d x \right )}}{a + b \sec {\left (c + d x \right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 393 vs.
\(2 (174) = 348\).
time = 0.49, size = 393, normalized size = 2.04 \begin {gather*} -\frac {\frac {48 \, {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (-2 \, a + 2 \, b\right ) + \arctan \left (-\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {-a^{2} + b^{2}}}\right )\right )} b^{5}}{\sqrt {-a^{2} + b^{2}} a^{5}} - \frac {3 \, {\left (3 \, a^{4} + 4 \, a^{2} b^{2} + 8 \, b^{4}\right )} {\left (d x + c\right )}}{a^{5}} + \frac {2 \, {\left (15 \, a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} + 24 \, a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} + 12 \, a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} + 24 \, b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} - 9 \, a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 40 \, a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 12 \, a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 72 \, b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 9 \, a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 40 \, a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 12 \, a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 72 \, b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 15 \, a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 24 \, a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 12 \, a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 24 \, b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )}^{4} a^{4}}}{24 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 3.42, size = 2678, normalized size = 13.88 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________